package org.aurora.model.metadata;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;

public class SchedulerMetaData implements Serializable {
    /**
     * 元数据更新时间
     */
    private Date metaDataUpdateTime = new Date();

    /**
     * 调度器地址(ip + : + port) -> 为调度器分配的 hash 槽
     */
    private Map<String, List<Integer>> schedulerAddrToSlotMap;

    /**
     * 为调度器分配的 hash 槽 -> 调度器地址(ip + : + port)
     */
    private Map<Integer, String> slotToSchedulerAddrMap;

    /**
     * 当前 scheduler 分配的 slots
     */
    private List<Integer> slots;

    /**
     * 主调度器 ip
     */
    private String mainSchedulerIp;

    /**
     * 主调度器端口
     */
    private int mainSchedulerPort;

    public SchedulerMetaData(Map<String, List<Integer>> schedulerAddrToSlotMap, Map<Integer, String> slotToSchedulerAddrMap, List<Integer> slots, String mainSchedulerIp, int mainSchedulerPort) {
        this.schedulerAddrToSlotMap = schedulerAddrToSlotMap;
        this.slotToSchedulerAddrMap = slotToSchedulerAddrMap;
        this.slots = slots;
        this.mainSchedulerIp = mainSchedulerIp;
        this.mainSchedulerPort = mainSchedulerPort;
    }

    public Date getMetaDataUpdateTime() {
        return metaDataUpdateTime;
    }

    public void setMetaDataUpdateTime(Date metaDataUpdateTime) {
        this.metaDataUpdateTime = metaDataUpdateTime;
    }

    public Map<String, List<Integer>> getSchedulerAddrToSlotMap() {
        return schedulerAddrToSlotMap;
    }

    public void setSchedulerAddrToSlotMap(Map<String, List<Integer>> schedulerAddrToSlotMap) {
        this.schedulerAddrToSlotMap = schedulerAddrToSlotMap;
    }

    public Map<Integer, String> getSlotToSchedulerAddrMap() {
        return slotToSchedulerAddrMap;
    }

    public void setSlotToSchedulerAddrMap(Map<Integer, String> slotToSchedulerAddrMap) {
        this.slotToSchedulerAddrMap = slotToSchedulerAddrMap;
    }

    public List<Integer> getSlots() {
        return slots;
    }

    public void setSlots(List<Integer> slots) {
        this.slots = slots;
    }

    public String getMainSchedulerIp() {
        return mainSchedulerIp;
    }

    public void setMainSchedulerIp(String mainSchedulerIp) {
        this.mainSchedulerIp = mainSchedulerIp;
    }

    public int getMainSchedulerPort() {
        return mainSchedulerPort;
    }

    public void setMainSchedulerPort(int mainSchedulerPort) {
        this.mainSchedulerPort = mainSchedulerPort;
    }
}
